/*
 * @Descripttion: 
 * @version: 1.0
 * @Author: Sam
 * @Date: 2022-03-26 02:58:38
 * @LastEditors: Sam
 * @LastEditTime: 2022-06-13 17:06:20
 */
import defaultSettings from '@/settings'

const { showSettings, fixedHeader, sidebarLogo,file_upload_url,media_upload_url } = defaultSettings

const state = {
  showSettings: showSettings,
  fixedHeader: fixedHeader,
  sidebarLogo: sidebarLogo,
  file_upload_url:file_upload_url,
  media_upload_url:media_upload_url,
  ajaxButton : false // ajax按钮状态
}

const mutations = {
  SET_AJAX_BUTTON: (state, status) => {
    state.ajaxButton = status
  },
  CHANGE_SETTING: (state, { key, value }) => {
    // eslint-disable-next-line no-prototype-builtins
    if (state.hasOwnProperty(key)) {
      state[key] = value
    }
  }
}

const actions = {
  changeSetting({ commit }, data) {
    commit('CHANGE_SETTING', data)
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}

